package day_2023_4_to_7;

/**
 * @author haomin
 * @date 2023/05/11 22:46
 **/
public class Day5_11_Num1016 {
    class Solution {
        public boolean queryString(String s, int n) {
            for(int i = n; i >= 1; --i) {
                StringBuffer sb = new StringBuffer();
                int j = i;
                while(j != 0) {
                    int a = j % 2;
                    j /= 2;
                    sb.append(a);
                }
                String ret = sb.reverse().toString();
                if(!s.contains(ret)) return false;
            }
            return true;
        }
    }
}